package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.github.pagehelper.PageInfo;
import com.rm.zeyou.entity.User;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.ChannelPayoutDetailService;
import com.rm.zeyou.util.login.LoginUtil;
import com.rm.zeyou.vo.request.SalesmanPayoutListVo;
import com.rm.zeyou.vo.request.SelectUserPayoutIndexVo;
import com.rm.zeyou.vo.response.ConfirmPayoutResponseVo;
import com.rm.zeyou.vo.response.SalesmanPayoutListResponseVo;
import com.rm.zeyou.vo.response.SelectUserPayoutIndexResponseVo;
import com.rm.zeyou.vo.response.UserPayoutVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 渠道商提现记录表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:07
 */
@Api(tags = "渠道商提现相关")
@RestController
@RequestMapping("/api/channelPayoutDetail")
public class ChannelPayoutDetailController {
    @Resource
    private ChannelPayoutDetailService channelPayoutDetailService;
    @Resource
    private LoginUtil loginUtil;

    @ApiOperation("渠道商提现页面")
    @PostMapping("selectChannelPayoutIndex")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<SelectUserPayoutIndexResponseVo> selectChannelPayoutIndex(@RequestBody SelectUserPayoutIndexVo requestVo){
        User user = loginUtil.getUser();
        return channelPayoutDetailService.selectChannelPayoutIndex(user,requestVo);
    }


    @ApiOperation("渠道商提现")
    @PostMapping("channelPayout")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<Integer> channelPayout(@RequestBody UserPayoutVo requestVo){
        User user = loginUtil.getUser();
        return channelPayoutDetailService.channelPayout(user,requestVo);
    }

    @ApiOperation("渠道商提现记录")
    @PostMapping("channelPayoutList")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<PageInfo<SalesmanPayoutListResponseVo>> channelPayoutList(@RequestBody SalesmanPayoutListVo requestVo){
        User user = loginUtil.getUser();
        return channelPayoutDetailService.channelPayoutList(user,requestVo);
    }

    @ApiOperation("渠道商确认提现列表")
    @PostMapping("channelConfirmPayout")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<List<ConfirmPayoutResponseVo>> channelConfirmPayout() {
        User user = loginUtil.getUser();
        return channelPayoutDetailService.channelConfirmPayout(user);
    }

}
